<div class="page-block">
    <?php
    echo $html->getTitle('cName');
    ?>   
    <div class="page">
        <div id="bookform">
        <?php echo $html->getContent('cIntro')?>  
        
    	<form method="post" onsubmit="checkform(this); return false" id="formpostbooking">
        <input type="hidden" name="tourname" value="<?php echo $tourname?>" />
    		<table cellpadding="5" cellspacing="5">
    			<tr>
    				<td width="140"  class="bold"><span class="sao1">*</span> <?php echo __('First Name')?>:</td>
    				<td width="200"><input type="text" class="tfield"  name="FirstName" /></td>
    				<td width="120" class="bold"><span class="sao1">*</span> <?php echo __('Last Name')?>:</td>
    				<td><input type="text" class="tfield"  name="LastName" /></td>
    			</tr>
    			<tr>
    				<td class="bold"><span class="sao1">*</span> <?php echo __('Email')?>:</td>
    				<td><input type="text" class="tfield"  name="Email" /></td>
    				<td class="bold"><span class="sao1">*</span> <?php echo __('Confirm Email')?>:</td>
    				<td><input type="text" class="tfield"  name="ConfirmEmail" /></td>
    			</tr>
    			<tr>
    				<td><?php echo __('Telephone')?>:</td>
    				<td colspan="3"><input type="text" class="tfield"  name="Phone" /></td>
    			</tr>
    			<tr>
    				<td class="bold" nowrap=""><span class="sao1">*</span> <?php echo __('Country of Residence')?>:</td>
    				<td colspan="3">
    					<select name="Country" class="tfield" style="width:200px">
    						<?echo $country->BuilOptionCountry()?>
    					</select>
    				</td>
    			</tr>
    			<tr>
    				<td style="padding-top:10px; padding-bottom:10px" nowrap="">
    					<span class="sao1">*</span> <?php echo __('Planned date of arrival')?>:
    				</td>
    				<td colspan="2">
    					<div style="float:left">
    						<input name="arrivalDate" type="text" id="arrivalDate" class="tfield" style="width: 80px" />
                            
    					</div>    				
    					<div style="float:right" class="bold"><span class="sao1">*</span> <?php echo __('Planned date of departure')?>:</div>
    				</td>
    				<td>
    					<input name="departureDate" type="text" id="departureDate" class="tfield" style="width:80px"/>
                        
    				</td>
    			</tr>
    			<tr>
    				<td>
    					<?php echo __('Adult')?>: 
    					<select class="tfield" name="Adult" style="width: 60px;">
    						<?echo ListIntOption(0,0,15)?>
    					</select>
    				</td>
    				<td>
    				<?php echo __('Children (2yrs to 12yrs)')?>:
    					<select class="tfield" name="Childrent" style="width: 60px;">
    						<?echo ListIntOption(0,0,15)?>
    					</select>
    				</td>
    				<td colspan="2">
    				<?php echo __('Infants (0yrs to 2yrs)')?>:
    					<select class="tfield" name="Infants" style="width: 60px;">
    						<?echo ListIntOption(0,0,15)?>
    					</select>
    				</td>
    			</tr>
    			
    			<tr style="display:none" id="display1">
    				<td colspan="4">
    				<?php echo __('Please use the box below to tell us what tweaks and changes and you would like to make to the program')?>
    				<textarea class="tfield" name="TellUs1" style="width:80%; height:100px"></textarea>
    			</tr>			
    			<tr style="display:none" id="display3">
    				<td colspan="4">
    					<div class="bold"><span class="sao1">*</span> Destinations you would like to visit (click to choose):
    					</div>
                        <div id="InquiriLoc" style="padding-top: 10px;"></div>
    					<input type="hidden" name="Destinations" id="Destinations" value="" />
                        <script type="text/javascript">
                            var lctcb=new Trcheckbox("InquiriLoc");
    					   <?php echo $listlocation?>
                        </script>
    				</td>
    			</tr>
    			
    			<tr>
    				<td colspan="4">
    				<?php echo __('Special interests - what you love doing when traveling:')?>
    				<textarea class="tfield" name="Special" style="width:80%; height:100px"></textarea>
    				</td>
    			</tr>    
                <tr>
                    <td colspan="4"><input type="checkbox" name="newsletter" /> <?php echo __('I would like to receive Us Newsletter and special promotions')?> </td>
                </tr>			
    			
    			<tr>
    				<td colspan="4">
    				<span class="sao1">*</span>  <?php echo __('Please enter the security code above:')?> 
    				<input type="text" class="tfield" style="width:50px" name="SpamCode" id="SpamCode" />
    				<img id="imgcodespam" src="/ImgSpam/<?echo time()?>.jpg" width="100" height="20" alt="Code Spam" 
    					onclick="this.src='/ImgSpam/'+Math.random()+'.jpg'" class="cpointer"/>
    				</td>
    			</tr>
    			<tr>
    				<td colspan="4">
    					<input type="submit" id="butsend" class="but1" value="<?echo __('Send')?>" />
    				</td>
    			</tr>
    		</table>
    	</form>  
        </div>
    </div>
</div>
<script type="text/javascript">
$(function(){

	// Datepicker
	$('#arrivalDate,#departureDate').datepicker({
		inline: true
	});	
	
	$('#arrivalDate').change( function() {
		var d = new Date($(this).val());
		if(d != '') $('#departureDate').datepicker('option', 'minDate', d);
		if( new Date($('#departureDate').val()) != 'Invalid Date'  && $('#departureDate').val() < $(this).val())
		{
			$('#departureDate').val($(this).val());
		}
	});


});

function changecb(cb)
{
	document.getElementById("display2").style.display='none';
	if(cb.checked)
	{
		document.getElementById("display2").style.display='';
	}
}
function changeradio(cb,idd)
{
	document.getElementById("display1").style.display='none';
	document.getElementById("display3").style.display='none';
	document.getElementById("selectr").value=cb.value;
	if(idd=='display3' && cb.checked==true)
	{
		document.getElementById("display3").style.display='';
	}else
	{
		document.getElementById("display1").style.display='';
	}
}
function checkform(fox)
{
    fox.Destinations.value=lctcb.get().name;
	if(fox.FirstName.value=="")
	{
		alert("<?php echo __('Please enter first name')?>!");
		fox.FirstName.focus();
		return false;
	}
	if(fox.LastName.value=="")
	{
		alert("<?php echo __('Please enter last name')?>!");
		fox.LastName.focus();
		return false;
	}
	if(!isEmail(fox.Email.value))
	{
		alert("<?php echo __('Please enter your email')?>!");
        fox.Email.focus();
        return false;
	}
	if(fox.Email.value!=fox.ConfirmEmail.value)
	{
		alert("<?php echo __('Email does not match')?>!");
        fox.ConfirmEmail.focus();
        return false;
	}
	
	if(fox.Country.value=="")
	{
		alert("<?php echo __('Please select country')?>!");
		fox.Country.focus();
		return false;
	}
	
	if(fox.arrivalDate.value=="")
	{
		alert("<?php echo __('Please enter your arrival date')?>!");
		fox.arrivalDate.focus();
		return false;
	}
	if(fox.departureDate.value=="")
	{
		alert("<?php echo __('Please enter your departure date')?>!");
		fox.departureDate.focus();
		return false;
	}
    	
	if(fox.SpamCode.value == "")
 	{
 		alert("<?php echo __('Please enter security code')?>!");		
 		fox.SpamCode.focus();
 		return false;
 	}	
	jQuery.post("/as/inserttour",
      $("#formpostbooking").serialize(),
      function(msg){
         postsuccess(msg);
      },
      'json'
    );
    getId('butsend').value="<?php echo __('Sending')?>...";
}       
function postsuccess(obj)
{
    getId('butsend').value="<?php echo __('Send')?>";
    if(obj.status=='spam')
    {
        getId('SpamCode').value='';
        getId('imgcodespam').src = '/ImgSpam/'+Math.random()+'.jpg';        
    }
    else if(obj.status=='ok')
    {
        getId('bookform').innerHTML=obj.msg;
        return;
    }
    if(obj.msg)
    {
        alert(obj.msg);
    }else
    {
        alert(obj);
    }
    
}
</script>